In [1]:
import pandas as pd
import numpy as np
In [2]:
unemployment_2018 = pd.read_csv(r"D:\nwank\Documents\Project\Cbs.csv")
unemployment_2018.head()
Out[2]:
State No State Labour force Unemployment Rate
0 32 ABIA 2,023,768 31.6
1 3 ADAMAWA 1,588,278 20.8
2 7 AKWA-IBOM 3,599,981 37.7
3 11 ANAMBRA 3,251,915 17.5
4 8 BAUCHI 2,122,724 23.5
In [3]:
import plotly
In [4]:
import plotly.io as pio
import plotly.express as px
import plotly.graph_objs as go
In [5]:
fig = px.bar(unemployment_2018, y = 'Unemployment Rate', x = 'State', orientation = 'v', color = 'Unemployment Rate')
fig.show()
In [6]:
import json
In [7]:
with open (r"D:\Downloads\Nig_states.geojson") as f:
    map_specs = json.load(f)
In [8]:
nigeria_coordinates = {"lat":9.0820, "lon":8.6753}
In [9]:
state_id_map={}
for feature in map_specs['features']:
    feature['id'] = feature['properties']['OBJECTID']
    state_id_map[feature['properties']['OBJECTID']] = feature['id']
In [10]:
fig = px.choropleth_mapbox(
    unemployment_2018,
    locations = "State No",
    color = "Unemployment Rate",
    center = nigeria_coordinates,
    geojson = map_specs,
    opacity = 0.7,
    zoom = 4.5,
    hover_name = "State",
    color_continuous_scale="redor",
    mapbox_style = "carto-positron",
    labels = {"State No":"Unemployment Rate"}

)
fig.show()
In [ ]: